<?php

namespace App\Http\Controllers;

use App\Services\CrudActions;
use App\Services\ModelServiceTrait;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Validator;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
    use ModelServiceTrait;
    use CrudActions;

    /**
     * @Inject
     * @var Response
     */
    protected $response;

    public function success($data = [], $msg = '')
    {
        return  [
            'code' => 200,
            'msg' => $msg,
            'data' => $data,
        ];
    }

    public function error($data = [], $msg = '')
    {
        return  [
            'code' => 500,
            'msg' => $msg,
            'data' => $data,
        ];
    }

    public function errorCode($code = 500, $data = [], $msg = '')
    {
        return  [
            'code' => $code,
            'msg' => $msg,
            'data' => $data,
        ];
    }


}
